﻿using System;
using Character;
using IllusionUtility.GetUtility;
using UnityEngine;

// Token: 0x0200013F RID: 319
public class Body : CharaShapeCustomBase
{
	// Token: 0x06000746 RID: 1862 RVA: 0x0002B520 File Offset: 0x00029720
	public Body(Human human, DynamicBone_Ver02 bustDynamicBone_L, DynamicBone_Ver02 bustDynamicBone_R) : base(human)
	{
		this.human = human;
		if (human.sex == SEX.FEMALE)
		{
			this.info = new ShapeBodyInfoFemale();
			this.bustSoft = new BustSoft(human);
			this.bustWeight = new BustGravity(human);
		}
		else if (human.sex == SEX.MALE)
		{
			this.info = new ShapeBodyInfoMale();
			this.bustSoft = null;
			this.bustWeight = null;
		}
		this.bustDynamicBone_L = bustDynamicBone_L;
		this.bustDynamicBone_R = bustDynamicBone_R;
		string name = (human.sex != SEX.FEMALE) ? Body.name_baseBoneRoot_M : Body.name_baseBoneRoot_F;
		string name2 = (human.sex != SEX.FEMALE) ? Body.name_bodyMeshRoot_M : Body.name_bodyMeshRoot_F;
		string name3 = (human.sex != SEX.FEMALE) ? Body.name_mnpbMeshRoot_M : Body.name_mnpbMeshRoot_F;
		this.AnimatedBoneRoot = human.transform.Find(name);
		Transform transform = human.transform.Find(name2);
		Transform transform2 = human.transform.Find(name3);
		AttachBoneWeight.Attach(this.AnimatedBoneRoot.gameObject, transform.gameObject, true);
		AttachBoneWeight.Attach(this.AnimatedBoneRoot.gameObject, transform2.gameObject, true);
		GameObject gameObject = this.AnimatedBoneRoot.FindLoop("N_Hand_L");
		if (null != gameObject)
		{
			GameObject gameObject2 = new GameObject("N_Hand_L_NEO");
			gameObject2.transform.SetParent(gameObject.transform.parent, false);
			gameObject2.transform.localPosition = gameObject.transform.localPosition;
			gameObject2.transform.localRotation = gameObject.transform.localRotation;
			gameObject2.transform.localScale = Vector3.one;
		}
	}

	// Token: 0x170000CF RID: 207
	// (get) Token: 0x06000747 RID: 1863 RVA: 0x0002B6E8 File Offset: 0x000298E8
	// (set) Token: 0x06000748 RID: 1864 RVA: 0x0002B6F0 File Offset: 0x000298F0
	public DynamicBone_Ver02 bustDynamicBone_L { get; private set; }

	// Token: 0x170000D0 RID: 208
	// (get) Token: 0x06000749 RID: 1865 RVA: 0x0002B6FC File Offset: 0x000298FC
	// (set) Token: 0x0600074A RID: 1866 RVA: 0x0002B704 File Offset: 0x00029904
	public DynamicBone_Ver02 bustDynamicBone_R { get; private set; }

	// Token: 0x170000D1 RID: 209
	// (get) Token: 0x0600074B RID: 1867 RVA: 0x0002B710 File Offset: 0x00029910
	// (set) Token: 0x0600074C RID: 1868 RVA: 0x0002B718 File Offset: 0x00029918
	public Transform AnimatedBoneRoot { get; private set; }

	// Token: 0x170000D2 RID: 210
	// (get) Token: 0x0600074D RID: 1869 RVA: 0x0002B724 File Offset: 0x00029924
	// (set) Token: 0x0600074E RID: 1870 RVA: 0x0002B72C File Offset: 0x0002992C
	public BustSoft bustSoft { get; private set; }

	// Token: 0x170000D3 RID: 211
	// (get) Token: 0x0600074F RID: 1871 RVA: 0x0002B738 File Offset: 0x00029938
	// (set) Token: 0x06000750 RID: 1872 RVA: 0x0002B740 File Offset: 0x00029940
	public BustGravity bustWeight { get; private set; }

	// Token: 0x170000D4 RID: 212
	// (get) Token: 0x06000751 RID: 1873 RVA: 0x0002B74C File Offset: 0x0002994C
	private Material NailMaterial
	{
		get
		{
			return this.rend_nail.materials[this.nailMaterialNo];
		}
	}

	// Token: 0x170000D5 RID: 213
	// (get) Token: 0x06000752 RID: 1874 RVA: 0x0002B760 File Offset: 0x00029960
	private Material ManicureMaterial
	{
		get
		{
			return this.rend_nail.materials[this.manicureMaterialNo];
		}
	}

	// Token: 0x170000D6 RID: 214
	// (get) Token: 0x06000753 RID: 1875 RVA: 0x0002B774 File Offset: 0x00029974
	// (set) Token: 0x06000754 RID: 1876 RVA: 0x0002B784 File Offset: 0x00029984
	public bool showUnderHair
	{
		get
		{
			return this.rend_underhair.enabled;
		}
		set
		{
			if (this.useUnderHair && this.rend_underhair)
			{
				this.rend_underhair.enabled = value;
			}
		}
	}

	// Token: 0x170000D7 RID: 215
	// (get) Token: 0x06000755 RID: 1877 RVA: 0x0002B7B0 File Offset: 0x000299B0
	// (set) Token: 0x06000756 RID: 1878 RVA: 0x0002B7B8 File Offset: 0x000299B8
	public bool useUnderHair { get; private set; }

	// Token: 0x06000757 RID: 1879 RVA: 0x0002B7C4 File Offset: 0x000299C4
	public void Load(GameObject obj, BodyParameter bodyParam)
	{
		this.obj = obj;
		this.anime = obj.GetComponentInChildren<Animator>();
		if (this.human.sex == SEX.FEMALE)
		{
			this.rend_nipL = Transform_Utility.FindTransform(obj.transform, Body.name_nipL).GetComponent<Renderer>();
			this.rend_nipR = Transform_Utility.FindTransform(obj.transform, Body.name_nipR).GetComponent<Renderer>();
			this.rend_underhair = Transform_Utility.FindTransform(obj.transform, Body.name_underhair_F).GetComponent<Renderer>();
			this.rend_skin = Transform_Utility.FindTransform(obj.transform, Body.name_skin_F).GetComponent<Renderer>();
			this.rend_nail = Transform_Utility.FindTransform(obj.transform, Body.name_nail_F).GetComponent<Renderer>();
			for (int i = 0; i < this.rend_nail.materials.Length; i++)
			{
				if (this.rend_nail.materials[i].name.IndexOf("cf_M_nail_iro") == 0)
				{
					this.manicureMaterialNo = i;
					break;
				}
			}
			if (this.rend_nail.materials.Length == 2)
			{
				this.nailMaterialNo = (this.manicureMaterialNo + 1) % 2;
			}
			for (int j = 0; j < 4; j++)
			{
				this.obj_underhair_sub[j] = Transform_Utility.FindTransform(obj.transform, Body.name_underhair_sub[j]).gameObject;
			}
			this.info.InitShapeInfo(CustomDataManager.BodyShapes_Female, CustomDataManager.BodyCategory_Female, obj.transform);
			base.Setup_MaterialAndTexture(this.rend_skin, "cf_m_body");
			if (this.nailRendTex != null)
			{
				UnityEngine.Object.Destroy(this.nailRendTex);
			}
			if (this.nailBaseTex == null)
			{
				this.nailBaseTex = this.NailMaterial.mainTexture;
			}
			int width = this.NailMaterial.mainTexture.width;
			int height = this.NailMaterial.mainTexture.height;
			this.nailRendTex = new RenderTexture(width, height, 0);
			this.nailRendTex.wrapMode = this.nailBaseTex.wrapMode;
			this.nailRendTex.useMipMap = true;
		}
		else if (this.human.sex == SEX.MALE)
		{
			this.rend_skin = Transform_Utility.FindTransform(obj.transform, Body.name_skin_M).GetComponent<Renderer>();
			this.rend_underhair = Transform_Utility.FindTransform(obj.transform, Body.name_underhair_M).GetComponent<Renderer>();
			this.info.InitShapeInfo(CustomDataManager.BodyShapes_Male, CustomDataManager.BodyCategory_Male, obj.transform);
			base.Setup_MaterialAndTexture(this.rend_skin, "cm_m_body");
		}
		string name = (this.human.sex != SEX.FEMALE) ? Body.name_tongue_M : Body.name_tongue_F;
		this.rend_tongue = Transform_Utility.FindTransform(obj.transform, name).GetComponent<Renderer>();
		this.SetShowTongue(this.showTongue);
		this.Load(bodyParam);
	}

	// Token: 0x06000758 RID: 1880 RVA: 0x0002BA9C File Offset: 0x00029C9C
	public void Load(BodyParameter bodyParam)
	{
		this.ShapeApply();
		this.ChangeNip();
		this.ChangeNail();
		this.ChangeManicure();
		this.ChangeUnderHair();
		this.LoadSkin();
		this.UpdateCustomHighlightMaterial();
	}

	// Token: 0x06000759 RID: 1881 RVA: 0x0002BAC8 File Offset: 0x00029CC8
	public void SetupBodyMaterialAndTexture()
	{
		string name_skinMaterial = (this.human.sex != SEX.FEMALE) ? "cm_m_body" : "cf_m_body";
		base.Setup_MaterialAndTexture(this.rend_skin, name_skinMaterial);
	}

	// Token: 0x0600075A RID: 1882 RVA: 0x0002BB04 File Offset: 0x00029D04
	public override void ShapeApply()
	{
		this.human.BodyShapeInfoApply();
		if (this.bustDynamicBone_L != null)
		{
			this.bustDynamicBone_L.ResetPosition();
		}
		if (this.bustDynamicBone_R != null)
		{
			this.bustDynamicBone_R.ResetPosition();
		}
		if (this.bustSoft != null)
		{
			this.bustSoft.ReCalc();
		}
		if (this.bustWeight != null)
		{
			this.bustWeight.ReCalc();
		}
		base.IsShapeChange = false;
		this.human.OnShapeApplied();
	}

	// Token: 0x0600075B RID: 1883 RVA: 0x0002BB94 File Offset: 0x00029D94
	public override void SetShape(int category, float value)
	{
		this.human.customParam.body.shapeVals[category] = value;
		base.IsShapeChange = true;
	}

	// Token: 0x0600075C RID: 1884 RVA: 0x0002BBB8 File Offset: 0x00029DB8
	public override float GetShape(int category)
	{
		return this.human.customParam.body.shapeVals[category];
	}

	// Token: 0x0600075D RID: 1885 RVA: 0x0002BBD4 File Offset: 0x00029DD4
	public void ChangeSunburn()
	{
		CombineTextureData sunburn = CustomDataManager.GetSunburn(this.human.customParam.body.sunburnID);
		this.sunburnTex = ((sunburn != null) ? AssetBundleLoader.LoadAsset<Texture2D>(sunburn.assetbundleDir, sunburn.assetbundleName, sunburn.textureName) : null);
		if (sunburn != null)
		{
			sunburn.isNew = false;
		}
	}

	// Token: 0x0600075E RID: 1886 RVA: 0x0002BC34 File Offset: 0x00029E34
	public void ChangeTattoo()
	{
		int tattooID = this.human.customParam.body.tattooID;
		CombineTextureData combineTextureData = (this.human.sex != SEX.FEMALE) ? CustomDataManager.GetBodyTattoo_Male(tattooID) : CustomDataManager.GetBodyTattoo_Female(tattooID);
		this.tattooTex = ((combineTextureData != null) ? AssetBundleLoader.LoadAsset<Texture2D>(combineTextureData.assetbundleDir, combineTextureData.assetbundleName, combineTextureData.textureName) : null);
		if (combineTextureData != null)
		{
			combineTextureData.isNew = false;
		}
	}

	// Token: 0x0600075F RID: 1887 RVA: 0x0002BCB0 File Offset: 0x00029EB0
	public void ChangeUnderHair()
	{
		if (this.human.sex == SEX.FEMALE)
		{
			BodyParameter body = this.human.customParam.body;
			UnderhairData underhair = CustomDataManager.GetUnderhair(body.underhairID);
			AssetBundleController assetBundleController = AssetBundleController.New_OpenFromFile(GlobalData.assetBundlePath, underhair.assetbundleName);
			if (underhair != null)
			{
				underhair.isNew = false;
			}
			if (underhair.prefab != "-")
			{
				this.rend_underhair.enabled = true;
				this.rend_underhair.material = assetBundleController.LoadAsset<Material>(underhair.prefab);
				this.useUnderHair = true;
			}
			else
			{
				this.rend_underhair.enabled = false;
				this.useUnderHair = false;
			}
			for (int i = 0; i < 4; i++)
			{
				GameObject gameObject = this.obj_underhair_sub[i];
				if (underhair.sub == i)
				{
					gameObject.SetActive(true);
					string assetName = underhair.prefab.Remove(underhair.prefab.Length - 1) + "1";
					Material material = assetBundleController.LoadAsset<Material>(assetName);
					Renderer[] componentsInChildren = gameObject.GetComponentsInChildren<Renderer>(true);
					foreach (Renderer renderer in componentsInChildren)
					{
						renderer.material = material;
					}
				}
				else
				{
					gameObject.SetActive(false);
				}
			}
			assetBundleController.Close(false);
		}
		this.ChangeUnderHairColor();
	}

	// Token: 0x06000760 RID: 1888 RVA: 0x0002BE10 File Offset: 0x0002A010
	public void ShowUnderHair(bool show)
	{
		this.rend_underhair.enabled = show;
	}

	// Token: 0x06000761 RID: 1889 RVA: 0x0002BE20 File Offset: 0x0002A020
	public void ShowUnderHair3D(bool show)
	{
		if (this.human.sex == SEX.MALE)
		{
			return;
		}
		BodyParameter body = this.human.customParam.body;
		UnderhairData underhair = CustomDataManager.GetUnderhair(body.underhairID);
		for (int i = 0; i < 4; i++)
		{
			GameObject gameObject = this.obj_underhair_sub[i];
			if (underhair.sub == i)
			{
				gameObject.SetActive(show);
			}
			else
			{
				gameObject.SetActive(false);
			}
		}
	}

	// Token: 0x06000762 RID: 1890 RVA: 0x0002BE98 File Offset: 0x0002A098
	public void ChangeUnderHairColor()
	{
		BodyParameter body = this.human.customParam.body;
		body.underhairColor.SetToMaterial(this.rend_underhair.material);
		for (int i = 0; i < 4; i++)
		{
			GameObject gameObject = this.obj_underhair_sub[i];
			if (gameObject != null && gameObject.activeSelf)
			{
				Renderer[] componentsInChildren = gameObject.GetComponentsInChildren<Renderer>(true);
				foreach (Renderer renderer in componentsInChildren)
				{
					body.underhairColor.SetToMaterial(renderer.material);
				}
			}
		}
	}

	// Token: 0x06000763 RID: 1891 RVA: 0x0002BF3C File Offset: 0x0002A13C
	public void ChangeNip()
	{
		if (this.human.sex != SEX.FEMALE)
		{
			return;
		}
		BodyParameter body = this.human.customParam.body;
		PrefabData nip = CustomDataManager.GetNip(body.nipID);
		if (nip != null)
		{
			nip.isNew = false;
		}
		Material material = AssetBundleLoader.LoadAsset<Material>(nip.assetbundleDir, nip.assetbundleName, nip.prefab);
		this.rend_nipL.material = material;
		this.rend_nipR.material = material;
		this.rend_nipL.material.renderQueue = 2451;
		this.rend_nipR.material.renderQueue = 2451;
		this.nipBaseTex = material.mainTexture;
		this.CreateNipTex();
		this.ChangeNipColor();
	}

	// Token: 0x06000764 RID: 1892 RVA: 0x0002BFF8 File Offset: 0x0002A1F8
	private void CreateNipTex()
	{
		Material material = this.rend_nipL.material;
		if (this.nipRendTex != null)
		{
			UnityEngine.Object.Destroy(this.nipRendTex);
		}
		int width = material.mainTexture.width;
		int height = material.mainTexture.height;
		this.nipRendTex = new RenderTexture(width, height, 0);
		this.nipRendTex.wrapMode = material.mainTexture.wrapMode;
		this.nipRendTex.useMipMap = true;
	}

	// Token: 0x06000765 RID: 1893 RVA: 0x0002C078 File Offset: 0x0002A278
	public void ChangeNipColor()
	{
		BodyParameter body = this.human.customParam.body;
		body.nipColor.SetToMaterial(this.rend_nipL.material);
		body.nipColor.SetToMaterial(this.rend_nipR.material);
		this.ChangeNipTexture();
	}

	// Token: 0x06000766 RID: 1894 RVA: 0x0002C0C8 File Offset: 0x0002A2C8
	private void ChangeNipTexture()
	{
		BodyParameter body = this.human.customParam.body;
		Material material = new Material(CustomDataManager.hsvOffset);
		bool sRGBWrite = GL.sRGBWrite;
		GL.sRGBWrite = true;
		Graphics.SetRenderTarget(this.nipRendTex);
		GL.Clear(false, true, Color.white);
		Graphics.SetRenderTarget(null);
		material.SetTexture("_MainTex", this.nipBaseTex);
		material.SetFloat("_OffsetH", body.nipColor.offset_h);
		material.SetFloat("_OffsetS", body.nipColor.offset_s);
		material.SetFloat("_OffsetV", body.nipColor.offset_v);
		Graphics.Blit(this.nipBaseTex, this.nipRendTex, material, 0);
		GL.sRGBWrite = sRGBWrite;
		this.rend_nipL.material.mainTexture = this.nipRendTex;
		this.rend_nipR.material.mainTexture = this.nipRendTex;
		UnityEngine.Object.Destroy(material);
	}

	// Token: 0x06000767 RID: 1895 RVA: 0x0002C1B8 File Offset: 0x0002A3B8
	public void ChangeNail()
	{
		if (this.human.sex != SEX.FEMALE)
		{
			return;
		}
		BodyParameter body = this.human.customParam.body;
		this.ChangeNailTex();
		body.nailColor.SetToMaterial(this.NailMaterial);
	}

	// Token: 0x06000768 RID: 1896 RVA: 0x0002C200 File Offset: 0x0002A400
	private void ChangeNailTex()
	{
		BodyParameter body = this.human.customParam.body;
		Material nailMaterial = this.NailMaterial;
		Material material = new Material(CustomDataManager.hsvOffset);
		bool sRGBWrite = GL.sRGBWrite;
		GL.sRGBWrite = true;
		Graphics.SetRenderTarget(this.nailRendTex);
		GL.Clear(false, true, Color.white);
		Graphics.SetRenderTarget(null);
		material.SetTexture("_MainTex", this.nailBaseTex);
		material.SetFloat("_OffsetH", body.nailColor.offset_h);
		material.SetFloat("_OffsetS", body.nailColor.offset_s);
		material.SetFloat("_OffsetV", body.nailColor.offset_v);
		Graphics.Blit(this.nailBaseTex, this.nailRendTex, material, 0);
		GL.sRGBWrite = sRGBWrite;
		nailMaterial.mainTexture = this.nailRendTex;
		UnityEngine.Object.Destroy(material);
	}

	// Token: 0x06000769 RID: 1897 RVA: 0x0002C2D8 File Offset: 0x0002A4D8
	public void ChangeManicure()
	{
		if (this.human.sex != SEX.FEMALE)
		{
			return;
		}
		BodyParameter body = this.human.customParam.body;
		Material manicureMaterial = this.ManicureMaterial;
		ColorParameter_PBR1 manicureColor = body.manicureColor;
		manicureMaterial.SetColor("_Color", manicureColor.mainColor1);
		manicureMaterial.SetFloat("_Metallic", manicureColor.specular1);
		manicureMaterial.SetFloat("_Glossiness", manicureColor.smooth1);
		body.manicureColor.SetToMaterial(this.ManicureMaterial);
	}

	// Token: 0x0600076A RID: 1898 RVA: 0x0002C35C File Offset: 0x0002A55C
	public void RendSkinTexture()
	{
		if (this.human.sex == SEX.FEMALE)
		{
			this.RendSkinTexture_Female();
		}
		else if (this.human.sex == SEX.MALE)
		{
			this.RendSkinTexture_Male();
		}
	}

	// Token: 0x0600076B RID: 1899 RVA: 0x0002C390 File Offset: 0x0002A590
	public void RendSkinTexture_Female()
	{
		BodyParameter body = this.human.customParam.body;
		CombineTextureData bodyTattoo_Female = CustomDataManager.GetBodyTattoo_Female(body.tattooID);
		float value = body.sunburnColor_A;
		Color tattooColor = body.tattooColor;
		Material material = new Material(CustomDataManager.skinBlendShader_Body);
		bool sRGBWrite = GL.sRGBWrite;
		GL.sRGBWrite = true;
		Graphics.SetRenderTarget(this.skinTex);
		GL.Clear(false, true, Color.white);
		Graphics.SetRenderTarget(null);
		if (this.sunburnTex == null)
		{
			value = 0f;
		}
		if (this.tattooTex == null)
		{
			tattooColor.a = 0f;
		}
		material.SetTexture("_BaseTex", this.skinBaseTex);
		material.SetFloat("_OffsetH", body.skinColor.offset_h);
		material.SetFloat("_OffsetS", body.skinColor.offset_s);
		material.SetFloat("_OffsetV", body.skinColor.offset_v);
		material.SetTexture("_SunburnTex", this.sunburnTex);
		material.SetFloat("_SunburnH", body.sunburnColor_H);
		material.SetFloat("_SunburnS", body.sunburnColor_S);
		material.SetFloat("_SunburnV", body.sunburnColor_V);
		material.SetFloat("_SunburnA", value);
		material.SetTexture("_TattooTex", this.tattooTex);
		if (this.tattooTex != null)
		{
			base.SetTattooOffsetAndTiling(material, "_TattooTex", 1024, 1024, this.tattooTex.width, this.tattooTex.height, bodyTattoo_Female.pos.x, bodyTattoo_Female.pos.y);
		}
		material.SetColor("_TattooColor", tattooColor);
		Graphics.Blit(this.skinBaseTex, this.skinTex, material, 0);
		GL.sRGBWrite = sRGBWrite;
		this.skinMaterial.mainTexture = this.skinTex;
		this.ChangeBumpRate();
		UnityEngine.Object.Destroy(material);
	}

	// Token: 0x0600076C RID: 1900 RVA: 0x0002C58C File Offset: 0x0002A78C
	public void RendSkinTexture_Male()
	{
		BodyParameter body = this.human.customParam.body;
		CombineTextureData bodyTattoo_Male = CustomDataManager.GetBodyTattoo_Male(body.tattooID);
		Color tattooColor = body.tattooColor;
		Material material = new Material(CustomDataManager.skinBlendShader_Male);
		bool sRGBWrite = GL.sRGBWrite;
		GL.sRGBWrite = true;
		Graphics.SetRenderTarget(this.skinTex);
		GL.Clear(false, true, Color.white);
		Graphics.SetRenderTarget(null);
		if (this.tattooTex == null)
		{
			tattooColor.a = 0f;
		}
		material.SetTexture("_BaseTex", this.skinBaseTex);
		material.SetFloat("_OffsetH", body.skinColor.offset_h);
		material.SetFloat("_OffsetS", body.skinColor.offset_s);
		material.SetFloat("_OffsetV", body.skinColor.offset_v);
		material.SetTexture("_TattooTex", this.tattooTex);
		if (this.tattooTex != null)
		{
			base.SetTattooOffsetAndTiling(material, "_TattooTex", 1024, 1024, this.tattooTex.width, this.tattooTex.height, bodyTattoo_Male.pos.x, bodyTattoo_Male.pos.y);
		}
		material.SetColor("_TattooColor", tattooColor);
		Graphics.Blit(this.skinMaterial.mainTexture, this.skinTex, material, 0);
		GL.sRGBWrite = sRGBWrite;
		this.skinMaterial.mainTexture = this.skinTex;
		this.ChangeBumpRate();
		UnityEngine.Object.Destroy(material);
	}

	// Token: 0x0600076D RID: 1901 RVA: 0x0002C710 File Offset: 0x0002A910
	public void ChangeBumpRate()
	{
		this.skinMaterial.SetFloat("_BumpScale", this.human.customParam.body.detailWeight);
	}

	// Token: 0x0600076E RID: 1902 RVA: 0x0002C738 File Offset: 0x0002A938
	public void ChangeSkinMaterial()
	{
		BodyParameter body = this.human.customParam.body;
		PrefabData prefabData = null;
		if (this.human.sex == SEX.FEMALE)
		{
			prefabData = CustomDataManager.GetBodySkin_Female(body.bodyID);
		}
		else if (this.human.sex == SEX.MALE)
		{
			prefabData = CustomDataManager.GetBodySkin_Male(body.bodyID);
		}
		if (prefabData != null)
		{
			prefabData.isNew = false;
		}
		AssetBundleController assetBundleController = new AssetBundleController();
		assetBundleController.OpenFromFile(prefabData.assetbundleDir, prefabData.assetbundleName);
		Material material = assetBundleController.LoadAsset<Material>(prefabData.prefab);
		this.skinBaseTex = material.mainTexture;
		assetBundleController.Close(false);
		this.skinMaterial.CopyPropertiesFromMaterial(material);
		this.human.UpdateSkinMaterial();
		this.human.wears.ChangeBodyMaterial(base.Rend_skin);
		Resources.UnloadUnusedAssets();
	}

	// Token: 0x0600076F RID: 1903 RVA: 0x0002C810 File Offset: 0x0002AA10
	public void LoadSkin()
	{
		this.ChangeSkinMaterial();
		this.ChangeSunburn();
		this.ChangeTattoo();
		this.RendSkinTexture();
		this.ChangeBumpRate();
	}

	// Token: 0x06000770 RID: 1904 RVA: 0x0002C830 File Offset: 0x0002AA30
	public override void CreateCustomHighlightMaterial()
	{
		base.CreateCustomHighlightMaterial(ref this.customHighlightMat_Skin, this.rend_skin);
		this.human.wears.ChangeBodyMaterial(this.rend_skin);
	}

	// Token: 0x06000771 RID: 1905 RVA: 0x0002C85C File Offset: 0x0002AA5C
	public override void DeleteCustomHighlightMaterial()
	{
		base.DeleteCustomHighlightMaterial(ref this.customHighlightMat_Skin, this.rend_skin);
		this.human.wears.ChangeBodyMaterial(this.rend_skin);
	}

	// Token: 0x06000772 RID: 1906 RVA: 0x0002C888 File Offset: 0x0002AA88
	public void SetShowTongue(bool show)
	{
		this.showTongue = show;
		if (this.rend_tongue != null)
		{
			this.rend_tongue.enabled = show;
		}
	}

	// Token: 0x06000773 RID: 1907 RVA: 0x0002C8B0 File Offset: 0x0002AAB0
	public void ShowNip(bool show)
	{
		if (this.rend_nipL != null)
		{
			this.rend_nipL.enabled = show;
		}
		if (this.rend_nipR != null)
		{
			this.rend_nipR.enabled = show;
		}
	}

	// Token: 0x06000774 RID: 1908 RVA: 0x0002C8EC File Offset: 0x0002AAEC
	public void ShowNail(bool show)
	{
		if (this.rend_nail != null)
		{
			this.rend_nail.enabled = show;
		}
	}

	// Token: 0x04000744 RID: 1860
	private const int UNDERHAIR_SUB_NUM = 4;

	// Token: 0x04000747 RID: 1863
	private Renderer rend_nipL;

	// Token: 0x04000748 RID: 1864
	private Renderer rend_nipR;

	// Token: 0x04000749 RID: 1865
	private Renderer rend_underhair;

	// Token: 0x0400074A RID: 1866
	private Renderer rend_nail;

	// Token: 0x0400074B RID: 1867
	private int nailMaterialNo;

	// Token: 0x0400074C RID: 1868
	private int manicureMaterialNo;

	// Token: 0x0400074D RID: 1869
	private Renderer rend_tongue;

	// Token: 0x0400074E RID: 1870
	private GameObject[] obj_underhair_sub = new GameObject[4];

	// Token: 0x0400074F RID: 1871
	private bool showTongue = true;

	// Token: 0x04000750 RID: 1872
	private Texture nipBaseTex;

	// Token: 0x04000751 RID: 1873
	private RenderTexture nipRendTex;

	// Token: 0x04000752 RID: 1874
	private Texture nailBaseTex;

	// Token: 0x04000753 RID: 1875
	private RenderTexture nailRendTex;

	// Token: 0x04000754 RID: 1876
	private Texture sunburnTex;

	// Token: 0x04000755 RID: 1877
	private Texture tattooTex;

	// Token: 0x04000756 RID: 1878
	private static readonly string name_nipL = "cf_O_tikubiL_00";

	// Token: 0x04000757 RID: 1879
	private static readonly string name_nipR = "cf_O_tikubiR_00";

	// Token: 0x04000758 RID: 1880
	private static readonly string[] name_underhair_sub = new string[]
	{
		"N_mnpk_bara00_00",
		"N_mnpk_bara01_00",
		"N_mnpk_bara02_00",
		"N_mnpk_bara03_00"
	};

	// Token: 0x04000759 RID: 1881
	private static readonly string name_underhair_F = "cf_O_mnpk";

	// Token: 0x0400075A RID: 1882
	private static readonly string name_underhair_M = "O_mnpk";

	// Token: 0x0400075B RID: 1883
	private static readonly string name_skin_F = "cf_O_body_00";

	// Token: 0x0400075C RID: 1884
	private static readonly string name_skin_M = "O_body";

	// Token: 0x0400075D RID: 1885
	private const string name_skinMaterial_F = "cf_m_body";

	// Token: 0x0400075E RID: 1886
	private const string name_skinMaterial_M = "cm_m_body";

	// Token: 0x0400075F RID: 1887
	private static readonly string name_baseBoneRoot_F = "p_cf_anim/cf_J_Root";

	// Token: 0x04000760 RID: 1888
	private static readonly string name_baseBoneRoot_M = "p_cm_anim/cm_J_Root";

	// Token: 0x04000761 RID: 1889
	private static readonly string name_bodyMeshRoot_F = "cf_body_00/cf_N_O_root";

	// Token: 0x04000762 RID: 1890
	private static readonly string name_mnpbMeshRoot_F = "cf_body_mnpb/cf_N_O_root";

	// Token: 0x04000763 RID: 1891
	private static readonly string name_bodyMeshRoot_M = "cm_body_00/cm_N_O_root";

	// Token: 0x04000764 RID: 1892
	private static readonly string name_mnpbMeshRoot_M = "cm_body_mnpb/cm_N_O_root";

	// Token: 0x04000765 RID: 1893
	private static readonly string name_nail_F = "cf_O_nail";

	// Token: 0x04000766 RID: 1894
	private static readonly string name_tongue_F = "cf_O_tang";

	// Token: 0x04000767 RID: 1895
	private static readonly string name_tongue_M = "cm_O_tang";
}
